package com.flow.demo.module.gd.dal.mysql.gduser;


import com.flow.demo.framework.common.pojo.PageResult;
import com.flow.demo.framework.mybatis.core.mapper.BaseMapperX;
import com.flow.demo.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.flow.demo.module.gd.controller.admin.user.vo.GdUserPageReqVO;
import com.flow.demo.module.gd.dal.dataobject.gduser.GdUserDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * ppd筛查-监护人用户 Mapper
 *
 * @author pompey_hpy
 */
@Mapper
public interface GdUserMapper extends BaseMapperX<GdUserDO> {

    default PageResult<GdUserDO> selectPage(GdUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GdUserDO>()
                .eqIfPresent(GdUserDO::getPhone, reqVO.getPhone())
                .likeIfPresent(GdUserDO::getNickName, reqVO.getNickName())
                .eqIfPresent(GdUserDO::getUnionId, reqVO.getUnionId())
                .eqIfPresent(GdUserDO::getPublicOpenid, reqVO.getPublicOpenid())
                .eqIfPresent(GdUserDO::getProgramOpenid, reqVO.getProgramOpenid())
                .eqIfPresent(GdUserDO::getSubscribeStatus, reqVO.getSubscribeStatus())
                .eqIfPresent(GdUserDO::getAvatar, reqVO.getAvatar())
                .betweenIfPresent(GdUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(GdUserDO::getId));
    }


}